(function () {
    var $$BASE = 'http://localhost:3232/wechat-manager';
    var API = {
        sys : {
            menu: {
                list  : $$BASE + '/sys/menu/list',
                get   : function (ik) {
                    return $$BASE + '/sys/menu/' + ik;
                },
                save  : $$BASE + '/sys/menu/save',
                remove: function (ik) {
                    return $$BASE + '/sys/menu/remove/' + ik;
                }
            },
            user: {
                page  : $$BASE + '/sys/user/page',
                get   : function (ik) {
                    return $$BASE + '/sys/user/' + ik;
                },
                update: $$BASE + '/sys/user/update',
                create: $$BASE + '/sys/user/create',
                remove: function (ik) {
                    return $$BASE + '/sys/user/remove/' + ik;
                },
                pass  : {
                    update: function (ik) {
                        return $$BASE + '/sys/user/' + ik + '/pass/update';
                    },
                    reset : function (ik) {
                        return $$BASE + '/sys/user/' + ik + '/pass/reset';
                    }
                }
            }
        },
        wct : {
            menu    : {
                get   : $$BASE + '/wct/menu/get',
                remove: $$BASE + '/wct/menu/remove',
                clear : $$BASE + '/wct/menu/clear',
                save  : $$BASE + '/wct/menu/save',
                sync  : $$BASE + '/wct/menu/sync'
            },
            user    : {
                page: $$BASE + '/wct/user/page',
                sync: $$BASE + '/wct/user/sync',
                send: $$BASE + '/wct/user/send'
            },
            template: {
                page  : $$BASE + '/wct/template/page',
                get   : function (ik) {
                    return $$BASE + '/wct/template/' + ik;
                },
                save  : $$BASE + '/wct/template/save',
                remove: function (ik) {
                    return $$BASE + '/wct/template/remove/' + ik;
                }
            },
            reply   : {
                page  : $$BASE + '/wct/reply/page',
                get   : function (ik) {
                    return $$BASE + '/wct/reply/' + ik;
                },
                save  : $$BASE + '/wct/reply/save',
                remove: function (ik) {
                    return $$BASE + '/wct/reply/remove/' + ik;
                }
            }
        },
        auth: {
            login : $$BASE + '/login',
            logout: $$BASE + '/logout'
        },
        role: {
            child: function (upId) {
                return $$BASE + '/admin/org/' + upId + '/child';
            }
        }
    };
    angular.module('app').constant('Api', API);
})();